﻿<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<head>
<title>添加新管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../style/adminStyle.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/jquery-3.1.1.min.js"></script>

<script type="text/javascript">

function updatadmin() {
	var str=${admin.jurisdiction};
	var jurisdiction=$("#jurisdiction").val();
	var details=$("#details").val();
	var rname=$("#rname").val();
	var phone=$("#phone").val();
	var email=$("#email").val();
	var id=$("#id").val();
	if(str==3){
		var msg = "您确定要修改吗？\n\n请确认！";
		if (confirm(msg)==true){
			$.ajax({
				"url":"${pageContext.request.contextPath}/Administrators/up_admin.do",
				"data":{'jurisdiction':jurisdiction,'details':details,
					'rname':rname,'phone':phone,'email':email,'id':id},
				"type":"POST",
				"dataType":"json",
				"success":function(obj){
					if(obj.state==1){
						alert("修改成功");
						location="${pageContext.request.contextPath}/Administrators/admin_list.do";
						
					}else{
						alert("修改失败");
					}
			
				}});
		
		}
	}else{
		alert("权限不足");
	}
	
			
				
	
		
}

</script>

</head>

<body>
 <div class="wrap">
  <div class="page-title">
    <span class="modular fl"><i class="user"></i><em>成员注册</em></span>
  </div>
  <table class="noborder">
    <tr>
    <td style="text-align:right;">ID：</td>
    <td><input type="text" class="textBox length-middle" name="id" id="id" value="${adm.id}" readonly="readonly"/></td>
   </tr>
  <tr>
    <td style="text-align:right;">账号/姓名：</td>
    <td><input type="text" class="textBox length-middle" name="rname" id="rname" value="${adm.rname}"/></td>
   </tr>
   <tr>
    <td style="text-align:right;">手机号码：</td>
    <td><input type="text" class="textBox length-middle" name="phone" id="phone" value="${adm.phone}"/></td>
   </tr>
   <tr>
    <td style="text-align:right;">电子邮箱：</td>
    <td><input type="text" class="textBox length-middle" name="email" id="email" value="${adm.email}"/></td>
   </tr>
     <tr>
    <td style="text-align:right;">权限：</td>
    <td>
     <c:if test="${adm.jurisdiction==1}">
     	<select class="textBox" id="jurisdiction">
    	<option value="1">初级管理员</option>
    	<option value="2">中级管理员</option>
    	</select>
		</c:if>
		
       <c:if test="${adm.jurisdiction==2}">
        <select class="textBox" id="jurisdiction">
    	<option value="2">中级管理员</option>
    	<option value="1">初级管理员</option>
    	</select>
		</c:if>
    	 <c:if test="${adm.jurisdiction==3}">
        <select class="textBox" id="jurisdiction">
    	<option value="3">高级管理员</option>
    	
    	</select>
		</c:if>
    
    </td>
   </tr>
    <tr>
    <td style="text-align:right;">职责：</td>
    <td>
    	 <c:if test="${adm.details==1}">
     	<select class="textBox" id="details">
    	<option value="1">运营人员</option>
    	<option value="2">合作方</option>
    	</select>
		</c:if>
		
       <c:if test="${adm.details==2}">
        <select class="textBox" id="details">
    	<option value="2">合作方</option>
    	<option value="1">运营人员</option>
    	</select>
		</c:if>
     	<c:if test="${adm.details==0}">
        <select class="textBox" id="details">
    	<option value="0">BOSS</option>
    	
    	</select>
		</c:if>
    
    </td>
   </tr>
   <tr>
    <td style="text-align:right;"></td>
    <td><input type="submit" class="tdBtn" value="修改" onclick="return updatadmin()"/></td>
   </tr>
 
  </table>
 </div>
</body>

</html>